Skip to content

[ef-28] fix: dashboard blank page on npm install (missing static assets)#25

Merged
NiveditJain merged 2 commits into
mainfrom
ef-28
Apr 7, 2026
Merged

[ef-28] fix: dashboard blank page on npm install (missing static assets)#25
NiveditJain merged 2 commits into
mainfrom
ef-28

Conversation

@NiveditJain

Copy link
Copy Markdown
Member

Problem

npm install -g failproofai@0.0.1-beta.3 installs and the server starts, but the dashboard renders as a completely blank page. All /_next/static/* requests return 404.

Root cause

Next.js standalone mode (output: "standalone") does not automatically copy .next/static/ (JS/CSS chunks, fonts, etc.) into the standalone output. The standalone server.js expects static assets at <server.js dir>/.next/static/ = .next/standalone/.next/static/, but that directory was never populated.

This was confirmed via Docker (node:20 --network host): the server started fine but curl returned bare HTML with no script tags.

Fix

package.json — 2 changes:

  1. build script — after next build, copy static assets into the standalone dir:

    cpSync('.next/static', '.next/standalone/.next/static', {recursive: true})
    
  2. prepare replaces prepublishOnlyprepublishOnly only fires during npm publish. Using prepare also covers npm pack and local npm install, so testing with a local tarball or npm install -g . now works correctly without manually running bun run build first.

Verification

Docker test (node:20 + bun, --network host):

  • Installed from local tarball built with the fix
  • ls .next/standalone/.next/static/ → chunks, CSS, manifests present ✓
  • Dashboard starts, curl -sL localhost:8020 | grep '<script' → 2 matches ✓
  • /_next/static references present in HTML ✓

🤖 Generated with Claude Code

Next.js standalone mode does not automatically include .next/static/
(JS/CSS chunks) in the standalone output. Without it every /_next/static/*
request 404s and the dashboard renders as a blank page.

- Extend `build` to cpSync .next/static → .next/standalone/.next/static
  after the Next.js build so the published package is self-contained.
- Replace `prepublishOnly` with `prepare` so the build also runs during
  `npm pack` and local `npm install`, fixing local installs that previously
  shipped without any build output.

Verified in Docker (node:20 + bun, --network host): dashboard starts,
HTML contains script tags and /_next/static references.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: fb18ed11-ee56-4cb9-904c-7ae342102e82

📥 Commits

Reviewing files that changed from the base of the PR and between 2e72252 and 75b3f9f.

📒 Files selected for processing (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

📝 Walkthrough

Walkthrough

Updated package.json: bumped package version, modified the build script to run Next build then copy .next/static into .next/standalone/.next/static via a Node one-liner, and replaced the prepublishOnly lifecycle hook with prepare.

Changes

Cohort / File(s) Summary
Build configuration
package.json
Bumped version 0.0.1-beta.30.0.1-beta.4. Changed build script to bun --bun next build && node -e "const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});" to copy static assets. Replaced prepublishOnly with prepare (both run bun run build).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 I hopped through build and night,
Collected static bits so tight,
Into standalone I made them go,
Quiet copies, soft and slow,
A tiny rabbit's build-time glow ✨


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@NiveditJain NiveditJain merged commit 3361804 into main Apr 7, 2026
8 checks passed
@NiveditJain NiveditJain deleted the ef-28 branch April 21, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant